﻿<html DIR="LTR" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ddue="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
  <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8" />
    <META NAME="save" CONTENT="history" />
    <title>Readme_Sales Orders Merge Replication Sample</title>
    
    
    
    <style TYPE="text/css">
body
{
background: #FFFFFF;
color: #000000;
font-family:    Verdana;
font-size: medium;
font-style: normal;
font-weight: normal;
margin-top: 0;
margin-bottom:  0;
margin-left:    0;
margin-right:   0;
width:  100%;
}

div.#mainSection
{
font-size: 70%;
width: 100%;
padding-left:    10;
margin-right: 10;
}

div.#mainBody
{
font-size: 90%;
margin-top: 10;
padding-bottom: 20;
}

div.#header
{
background-color: #D2D2D2;
padding-top:    0;
padding-bottom: 0;
padding-left:   10;
padding-right:  0;
width:          100%;
}

div.#header table
{
border-bottom-color: #C8CDDE;
border-bottom-style: solid;
border-bottom-width: 1;
width:  100%;
}

span.#runningHeaderText
{
color: #003399;
font-size: 90%;
}

span.#nsrTitle
{
/*    color: #003399;*/
font-size: 120%;
font-weight: 600;
}

div.#header table td
{
color: #000000;
font-size: 70%;
margin-top: 0;
margin-bottom:  0;
padding-right: 20;
}

div.#header table tr.#headerTableRow3 td
{
padding-bottom: 2;
padding-top: 5;
}

div.#header table.#bottomTable
{
border-top-color: #FFFFFF;
border-top-style: solid;
border-top-width: 1;
text-align: left;
}

div.#footer
{
font-size: 90%;
margin-top: 0;
margin-bottom:  0;
margin-left:    -5;
margin-right:   0;
padding-top:    2;
padding-bottom: 2;
padding-left:   0;
padding-right:  0;
width:  100%;
}

hr.#footerHR
{
border-bottom-color: #EEEEFF;
border-bottom-style: solid;
border-bottom-width: 1;
border-top-color: C8CDDE;
border-top-style: solid;
border-top-width: 1;
height: 3;
color: #D2D2D2;
}

div.section
{
padding-top:    2;
padding-bottom: 2;
padding-right:  15;
width:  100%;
}

.heading
{
color:          #000000;
font-weight:    bold;
margin-top:     18;
margin-bottom:  8;
}

h1.heading
{
color: #000000;
font-size:  150%;
}

.subHeading
{
color:          #000000;
font-weight:    bold;
font-size:      150%;
margin-bottom:  4;
}

h2.subHeading
{
color:          #000000;
font-weight:    bold;
font-size:      130%;
}
h3.subHeading
{
color:  #000000;
font-size: 125%;
font-weight: bold;
}

h4.subHeading
{
color: #000000;
font-size: 110%;
font-weight: bold;
}

h4.procedureHeading
{
color: #000080;
font-size: 110%;
font-weight: bold;
}

h5.subHeading
{
color: #000000;
font-size: 100%;
font-weight: bold;
}

img
{
padding-bottom: 10;
}

img.toggle
{
border: 0;
margin-right: 5;
padding-bottom: 10;
}

img.copyCodeImage
{
border: 0;
margin: 1;
margin-right: 3;
padding-bottom: 10;
}

img.downloadCodeImage
{
border: 0;
margin-right: 3;
padding-bottom: 10;
}

img.viewCodeImage
{
border: 0;
margin-right: 3;
padding-bottom: 10;
}

img.note
{
border: 0;
margin-right: 3;
padding-bottom: 10;
}

img.#membersOptionsFilterImage
{
border: 0;
margin-left: 10;
vertical-align: middle;
padding-bottom: 10;
}

img.#toggleAllImage
{
margin-left: 4;
vertical-align: middle;
padding-bottom: 10;
}

div.#mainSection table
{
border: 0;
font-size: 100%;
width:  100%;
margin-top: 5px;
margin-bottom: 15px;
}

div.#mainSection table tr
{
vertical-align: top;
}

div.#mainSection table th
{
text-align: left;
background: #D8D8D8;
border-bottom-color: #D8D8D8;
border-bottom-style: solid;
border-bottom-width: 1;
color: #000000;
padding-left: 5;
padding-right: 5;
}

div.#mainSection table td
{
background: #F2F2F2;
border-top-color: #D8D8D8;
border-top-style: solid;
border-top-width: 1;
padding-left: 5;
padding-right: 5;
}

div.#mainSection table td.imageCell
{
white-space: nowrap;
}

div.code
{
width: 98%;
}

div.code table
{
border: 0;
font-size: 95%;
margin-bottom: 5;
width: 100%
}

div.code table th
{
text-align: left;
background: #D8D8D8;
border-bottom-color: #D8D8D8;
border-bottom-style: solid;
border-bottom-width: 1;
color: #000000;
font-weight: bold;
padding-left: 5;
padding-right: 5;
}

div.code table td
{
background: #CCCCCC;
border-top-color: #D8D8D8;
border-top-style: solid;
border-top-width: 1;
padding-left: 5;
padding-right: 5;
padding-top: 5;
}

div.alert
{
margin-left: 10;
width: 98%;
}

div.alert table
{
border: 1;
font-size: 100%;
width:  100%;
border: solid 1 #DEDFEF;
}

div.alert table th
{
text-align: left;
background: #D8D8D8;
border-bottom-width: 0;
color: #000000;
padding-left: 5;
padding-right: 5;
border: solid 1 #DEDFEF;
}

div.alert table td
{
background: #FFFFFF;
border-top-color: #D8D8D8;
border-top-style: solid;
border-top-width: 1;
padding-left: 5;
padding-right: 5;
border: solid 1 #DEDFEF;
}

span.copyCode
{
color: #0000ff;
font-size: 90%;
font-weight: normal;
cursor: hand;
float: right;
display: inline;
text-align: right;
}

.downloadCode
{
color: #0000ff;
font-size: 90%;
font-weight: normal;
cursor: hand;
}

.viewCode
{
color: #0000ff;
font-size: 90%;
font-weight: normal;
cursor: hand;
}

div.code pre
{
font-family:    Monospace, Courier New, Courier;
font-size: 105%;
color:  #000000;
}

code
{
font-family:    Monospace, Courier New, Courier;
font-size: 105%;
color:  #000000;
}

dl
{
margin-top: 0;
padding-left:   1;
}

dd
{
margin-bottom:  0;
margin-left:    0;
padding-left:   20;
}

dd p
{
margin-top: 5;
}

ul
{
margin-left: 17;
list-style-type: disc;
}

ul ul
{
margin-bottom: 4;
margin-left: 17;
margin-top: 3;
list-style-type: disc;
}

ol
{
margin-left: 24;
list-style-type: decimal;
}

ol ol
{
margin-left: 24;
margin-top: 3;
list-style-type: lower-alpha;
}

li
{
margin-top: 0;
margin-bottom: 0;
padding-bottom: 0;
padding-top: 0;
margin-left: 5;
}

p
{
margin-bottom: 15;
}

.tip
{
color:  #0000FF;
font-style: italic;
cursor:hand;
text-decoration:underline;
}

.math
{
font-family: Times New Roman;
font-size: 125%
}
.sourceCodeList
{
font-family: Verdana;
font-size: 90%;
}

pre.viewCode
{
width: 100%;
overflow: auto;
}

li:hover table, li.over table
{
background-color: #C0C0C0;
}

li:hover ul, li.over ul
{
background-color: #d2d2d2;
border: 1px solid #000;
display: block;
}
            </style>
  </head>
  <body>
    <!--Topic built:08/05/2008 01:28:33-->

    
    
    
    
    
    
    
    
    
    <div id="header">
      <table width="100%" id="topTable"><tr>
          <td align="left">
            <span id="nsrTitle">Readme_Sales Orders Merge Replication Sample</span>
          </td>
          <td align="right">
            <span id="headfb" class="feedbackhead">
            </span>
          </td>
        </tr></table>
      
      
      
    </div>
    <div id="mainSection">
      <div id="mainBody"><p> 08/05/2008 01:28:33</p>
        
        <font color="DarkGray"> </font><p /> 
        <span id="changeHistory">
        </span>
    <p>
      This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.
    </p>
    <p>This readme file details how to install and run the Sales Orders sample. This file also details any known issues with the sample.</p>
  <h1 class="heading">Scenario</h1><div id="sectionSection0" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">This sample highlights a merge replication topology for delivering data to mobile users, and it also demonstrates the programmability features of merge replication in SQL Server. The sample is a Windows Forms-based application that uses standard Microsoft data access technologies and merge replication to enable a salesperson to maintain her own local data while synchronizing periodically with the home office. This sample is supported for Subscribers running all editions of SQL Server. The publication also supports SQL Server Compact 3.5 Subscribers. For more information about this sample scenario, see <b>Sales Orders Sample Scenario</b>.</p>
    </content></div><h1 class="heading">Languages</h1><div id="sectionSection1" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <ul xmlns=""><li>
          C#<br />
        </li><li>
          
            Transact-SQL <br />
        </li></ul>
    </content></div><h1 class="heading">Features</h1><div id="sectionSection2" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">The Sales Orders sample demonstrates the following features of merge replication:</p>
      <ul xmlns=""><li>
          Replication Management Objects (RMO).<br />
        </li><li>
          Parameterized row filters.<br />
        </li><li>
          Precomputed partitions.<br />
        </li><li>
          Client-requested partitioned snapshot.<br />
        </li><li>
          Article type-based performance optimizations.<br />
        </li><li>
          
            SQL Server Compact 3.5 and SQL Server Express Subscribers.<br />
        </li><li>
          Automatic identity range management.<br />
        </li><li>
          Business logic handlers.<br />
        </li><li>
          Web synchronization (optional).<br />
        </li></ul>
      <p xmlns="">For more information about how these replication features are demonstrated in the sample, see <b>Sales Orders Sample Implementation Details</b>.</p>
    </content></div><h1 class="heading">Prerequisites</h1><div id="sectionSection3" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">This sample is supported only on default installations of SQL Server. Named instances are not supported. Before running this sample, make sure the following software is installed:</p>
      <ul xmlns=""><li>
          
            SQL Server 2005 or later version, including the following optionally installed components:<br />
          <ul><li>
              
                SQL Server Database Engine Services (including replication)<br />
            </li><li>
              Client Tools<br />
            </li><li>
              
                AdventureWorks Sample OLTP Database. This sample database is available on the <b>Microsoft SQL Server Samples and Community Projects</b> page on <a href="http://go.microsoft.com/fwlink/?linkid=62796" alt=""><linkText xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">CodePlex</linkText></a>.<br />
            </li><li>
              The SQL Server samples. These samples are available on the <b>Microsoft SQL Server Samples and Community Projects</b> page on <a href="http://go.microsoft.com/fwlink/?linkid=62796" alt=""><linkText xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">CodePlex</linkText></a>. For more information, see <a href="html/e8117979-fe03-441e-be85-894fa616227a.htm">Considerations for Installing SQL Server Samples and Sample Databases</a>.<br />
            </li></ul>
        </li><li>
          
            .NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge. For more information, see <b>Installing the .NET Framework Documentation</b>.<br />
        </li></ul>
    </content></div><h1 class="heading">Required Permissions</h1><div id="sectionSection4" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">The permissions needed to configure and run the Sales Orders sample are based on replication security requirements, and are as follows:</p>
      <ul xmlns=""><li>
          To run InstallSalesOrdersSample.bat, which configures replication, creates the AdvWorksSalesOrders publication, and generates the initial snapshot, your Windows account must be a member of the <notLocalizable xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5"><b xmlns="">sysadmin</b></notLocalizable> fixed server role at the Publisher. <br />
        </li><li>
          The Sales Orders sample does various Database Engine and replication tasks, including creating the <notLocalizable xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5"><b xmlns="">AdventureWorksLocal</b></notLocalizable> database, creating the local Subscription, and running the Merge Agent to initialize, reinitialize or synchronize the subscription. In order to successfully run the sample executable (SalesOrders.exe) at the Subscriber, your Windows account must have at least CREATE DATABASE permissions at the Subscriber.<br />
          <div class="alert"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Note: </th></tr><tr><td>
            When the local database and subscription exists, your Windows account must be at least a member of the <notLocalizable xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5"><b xmlns="">db_owner</b></notLocalizable> fixed database role on the <notLocalizable xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5"><b xmlns="">AdventureWorksLocal</b></notLocalizable> database at the Subscriber to run the application.<p />
          </td></tr></table><p /></div>
        </li><li>
          To initialize the subscription and synchronize with the Publisher, the Windows account used to connect to the Publisher (or with the Web server when using Web synchronization) must meet the following requirements:<br />
          <ul><li>
              Have a valid login at the Publisher associated with a user in the publication database.<br />
            </li><li>
              Have a valid login at the Distributor associated with a user in the distribution database (of the guest user).<br />
            </li><li>
              Be a member of the publication access list (PAL) for the AdvWorksSalesOrders publication. <br />
            </li></ul>
        </li></ul>
    </content></div><h1 class="heading">Building and Configuring the Sample</h1><div id="sectionSection5" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">To build the sample project and configure the replication topology, you will need to do the following:</p>
      <ul xmlns=""><li>
          At the Publisher, run the replication installation script.<br />
        </li><li>
          (Optional) Configure the Internet Information Services (IIS) server to support Web synchronization for merge replication. If this is not done, you cannot use the Web synchronization feature of the sample. <br />
        </li><li>
          At the Subscriber, modify the configuration settings in the app.config file of the sample.<br />
        </li><li>
          At the Subscriber, build the sample using Visual Studio 2005 or the .NET Framework 2.0 SDK.<br />
        </li><li>
          At the Subscriber, place a copy of the BusinessLogic.dll assembly in the C:\Program Files\Microsoft SQL Server\100\COM directory. When using Web synchronization, you must also place a copy of BusinessLogic.dll in the C:\Program Files\Microsoft SQL Server\100\COM directory on the Web server.<br />
        </li></ul>
      <h4 class="procedureHeading" xmlns="">To configure the Sales Orders sample at the Publisher</h4><div id="procedureSectionEDBJBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Ensure that the <b>AdventureWorks</b> sample database has been installed and the database is attached. For more information, see <a href="html/e8117979-fe03-441e-be85-894fa616227a.htm">Considerations for Installing SQL Server Samples and Sample Databases</a>.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Ensure that the SQL Server Database Engine samples have been installed. For more information, see <a href="html/e8117979-fe03-441e-be85-894fa616227a.htm">Considerations for Installing SQL Server Samples and Sample Databases</a>.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Ensure that SQL Server Agent is running. You can view the status of and start this service from <b>Object Explorer</b> in SQL Server Management Studio. </p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Navigate to the installation location for the Sales Order sample scripts. The default is C:\Program Files\Microsoft SQL Server\100\Samples\Replication\Merge\SalesOrders\Scripts.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">(Optional) Configure Secure Sockets Layer (SSL) at the Publisher or at the server used for Web synchronization. SSL is required for communication between the IIS server and all Subscribers. To configure SSL, specify a server certificate for the IIS server to use. </p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Execute InstallSalesOrdersSample.bat and when prompted enter the login (in the case-sensitive format "DOMAIN\login") and password for the Windows account under which the Snapshot Agent job will run. This calls sqlcmd.exe to execute CreateAdvWorksSalesOrdersPublication.sql, which does the following:</p>
              <ul xmlns=""><li>
                  Checks that replication has been configured on the local server, and if not configures it as a Publisher with local Distributor using the distribution database. <br />
                </li><li>
                  Drops and re-creates the stored procedures and user-defined functions used for data access at the client.<br />
                </li><li>
                  Drops and re-creates the AdvWorksSalesOrders Publication.<br />
                </li><li>
                  Adds articles to the publication.<br />
                </li><li>
                  Registers the business logic handler at the Distributor.<br />
                </li><li>
                  Starts the Snapshot Agent job to generate the initial snapshot.<br />
                </li></ul>
              <p xmlns="">The batch file can also automatically configure a virtual directory at the Publisher to support Web synchronization. If you choose not configure the virtual directory at the Publisher during installation, or if you plan to use a separate Web server, you must run the Configure Web Synchronization Wizard prior to using the Web synchronization features of the sample. </p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">(Optional) Run the Configure Web Synchronization Wizard to configure an IIS server to support Web synchronization. Skip this step if InstallSalesOrdersSample.bat successfully created the virtual directory or if you will not use Web synchronization. For complete instructions about using this wizard, see <b>How to: Configure IIS for Web Synchronization</b>. </p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Before continuing, ensure that the Snapshot Agent job for the AdvWorksSalesOrders publication has successfully completed. The status of this job can be viewed using Replication Monitor. For information about using Replication Monitor to view the status of a Snapshot Agent job, see the topic <b>How to: View Information and Perform Tasks for the Agents Associated With a Publication (Replication Monitor)</b> in SQL Server Books Online. </p>
            </content>
          </li></ol></div>
      <h4 class="procedureHeading" xmlns="">To build and configure the Sales Orders sample at the Subscriber</h4><div id="procedureSectionEBBJBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">At the command prompt, navigate to the SQL Server samples installation directory. The default is C:\Program Files\Microsoft SQL Server\100\Samples\. </p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Execute the following at a .NET Framework or Microsoft Visual Studio 2005 command prompt:</p>
              <p xmlns="">
                <code>sn -k SampleKey.snk</code>
              </p>
              <div class="alert" xmlns=""><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Note: </th></tr><tr><td>
                You can skip this step if this key was previously created for use with another sample. <p />
              </td></tr></table><p /></div>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Navigate to the installation location for the Sales Orders sample solution in Microsoft Visual C#. The default is C:\Program Files\Microsoft SQL Server\100\Samples\Replication\Merge\SalesOrders\CS.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Open the SalesOrders.sln solution file in Visual Studio 2005.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Build the project. </p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">In the project output folder, edit the SalesOrders.exe.config file and change the following: </p>
              <ul xmlns=""><li>
                  Replace the value of the Subscriber key with the name of the local server.<br />
                </li><li>
                  Replace the value of the Publisher key with the name of the server configured previously as the Publisher. <br />
                </li><li>
                  (Optional) Replace the value of the WebSynchronizationUrl key when connecting to the Publisher using Web synchronization. This can also be done at run time.<br />
                </li><li>
                  (Optional) Use the SyncWhenConnectedInterval key to set the interval between synchronizations, in seconds, when using the synchronize-when-connected functionality. <br />
                </li></ul>
              <div class="alert" xmlns=""><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Note: </th></tr><tr><td>
                Replication does not support localhost for server names.<p />
              </td></tr></table><p /></div>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Place a copy of the BusinessLogic.dll assembly in the C:\Program Files\Microsoft SQL Server\100\COM directory. </p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">(Optional) If using Web synchronization, place a copy of the BusinessLogic.dll assembly in the C:\Program Files\Microsoft SQL Server\100\COM directory on the Web server.</p>
            </content>
          </li></ol></div>
    </content></div><h1 class="heading">Running the Sample</h1><div id="sectionSection6" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <h4 class="procedureHeading" xmlns="">To run the Sales Orders sample and synchronize data</h4><div id="procedureSectionEDBHBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Ensure that remote connections are enabled at the Publisher and at the Subscriber (TCP/IP or Named Pipes) and that the SQL Server Agent service is running.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">(Optional) At the Subscriber, test the Web synchronization connection by connecting to the Web server in diagnostic mode following the instructions on "To configure client certificates at the Subscriber" in <b>How to: Configure Web Synchronization for Merge Replication (Replication Transact-SQL Programming)</b>.</p>
              <div class="alert" xmlns=""><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Note: </th></tr><tr><td>
                If an HTTP error occurs when using Web synchronization, open Internet Explorer, and from the <b>Tools</b> menu select <b>Internet Options</b>, <b>Connections</b>, and <b>LAN Settings</b>. Ensure that <b>Automatically detect settings</b> is disabled.<p />
              </td></tr></table><p /></div>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Start SalesOrders.exe from Visual Studio 2005 or from the command prompt. When the application runs for the first time, the subscription database and subscription are created and the Merge Agent is started to initialize the subscription.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">After the subscription data has been initialized, the <b>Sales Orders</b> form will load, displaying a list of existing orders that belong to salesperson "adventure-works\garrett1". </p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Using the <b>Sales Orders</b> form, you can make the following changes to sales data:</p>
              <ul xmlns=""><li>
                  Edit sales order information.<br />
                </li><li>
                  Add a new item to a sales order. <br />
                </li><li>
                  Delete an item from a sales order.<br />
                </li><li>
                  Change the ordered quantity for an item in a sales order.<br />
                </li></ul>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Select a synchronization method from the <b>Synchronize</b> menu to synchronize the subscription. </p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">(Optional) Check <b>Synchronize When Connected</b> to automatically synchronize the subscription. Set the synchronization interval for background synchronization using the SyncWhenConnectedInterval key in the app.config file.</p>
              <div class="alert" xmlns=""><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Note: </th></tr><tr><td>
                The <b>Synchronize When Connected</b> feature is not available when running on Microsoft Windows 2000 platforms. For more information, see <b>Sales Orders Sample Implementation Details</b>.<p />
              </td></tr></table><p /></div>
            </content>
          </li></ol></div>
      <h4 class="procedureHeading" xmlns="">To use advanced synchronization options of the Sales Orders sample</h4><div id="procedureSectionEBBHBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">From <b>Advanced</b> in the <b>Synchronize</b> menu, choose one of the following options:</p>
              <ul xmlns=""><li>
                  (Optional) Select a reinitialize option to reinitialize the subscription. <br />
                </li><li>
                  (Optional) Select <b>Web Synchronization Options</b> and supply the Internet URL and the Windows Authentication credentials used to access the Web server over a secure HTTPS connection. To use this option, you must have already configured an IIS server for Web synchronization. <br />
                  <div class="alert"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Note: </th></tr><tr><td>
                    Upload-only or download-only synchronization is not supported with Web synchronization. When Web synchronization is enabled, the <b>Only Upload Data</b> menu item is disabled.<p />
                  </td></tr></table><p /></div>
                </li><li>
                  (Optional) Select <b>Get Subscription Status</b> to view the results the most recent Merge Agent sessions. <br />
                </li></ul>
            </content>
          </li></ol></div>
    </content></div><h1 class="heading">Removing the Sample</h1><div id="sectionSection7" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">Use the following procedure to remove the Sales Orders sample.</p>
      <h4 class="procedureHeading" xmlns="">To delete the subscription only</h4><div id="procedureSectionEDBFBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">At the Subscriber, execute the following Transact-SQL script to delete the pull subscription.</p>
              <div class="code" xmlns="">
		<span codeLanguage="other"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left" style="border-right-style: none;" /></tr><tr><td colspan="2"><pre>-- This batch is executed at the Subscriber to remove 
-- the Sales Orders sample subscription.
DECLARE @publisher AS sysname;

-- change this value to the name of the Publisher server.
SET @publisher = N'PUBSERVER'; 

USE [AdventureWorksLocal]
EXEC sp_dropmergepullsubscription 
  @publisher = @publisher, 
  @publisher_db = N'AdventureWorks',
  @publication = N'AdvWorksSalesOrders';
GO
</pre></td></tr></table></span>
	</div>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">At the Publisher, execute the following Transact-SQL script to unregister the pull subscription.</p>
              <div class="code" xmlns="">
		<span codeLanguage="other"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left" style="border-right-style: none;" /></tr><tr><td colspan="2"><pre>-- This batch is executed at the Publisher to remove 
-- the Sales Orders sample subscription.
DECLARE @subscriber AS sysname;

-- change this value to the name of the Subscriber server.
SET @subscriber = N'SUBSERVER'; 

USE [AdventureWorks]
EXEC sp_dropmergesubscription 
  @publication = N'AdvWorksSalesOrders', 
  @subscriber = @subscriber, 
  @subscriber_db = N'AdventureWorksLocal';
GO
</pre></td></tr></table></span>
	</div>
            </content>
          </li></ol></div>
      <h4 class="procedureHeading" xmlns="">To remove the Sales Orders sample</h4><div id="procedureSectionEBBFBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">At the Publisher, navigate to the installation location for the Sales Order sample scripts. The default is C:\Program Files\Microsoft SQL Server\100\Samples\Replication\Merge\SalesOrders\Scripts.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Execute the batch file RemoveSalesOrdersSample.bat. </p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">When prompted, type "Y" and press <b>Enter</b> to remove all replication objects at the Publisher, remove all replication objects in the subscription database, and uninstall publishing and distribution at the Publisher. </p>
              <div class="alert" xmlns=""><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Important: </th></tr><tr><td>
                When using this script, all replication infrastructure will be removed. If you have created other publications that use this Publisher or Distributor, do not execute DropAdvWorksSalesOrdersPublication.sql. Instead, you should remove the AdvWorksSalesOrders publication manually. For more information, see <b>How to: Delete a Publication (SQL Server Management Studio)</b> or <b>How to: Delete a Publication (Replication Transact-SQL Programming)</b> in SQL Server Books Online. <p />
              </td></tr></table><p /></div>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">At the Subscriber on the <notLocalizable xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5"><b xmlns="">AdventureWorksLocal</b></notLocalizable> database, execute <b>sp_removedbreplication (Transact-SQL)</b>. </p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Change the database context to the <notLocalizable xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5"><b xmlns="">master</b></notLocalizable> database and execute <code>DROP DATABASE AdventureWorksLocal</code>.</p>
            </content>
          </li></ol></div>
    </content></div><h1 class="heading">Comments</h1><div id="sectionSection8" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator. </p>
    </content></div><h1 class="heading">See Also</h1><div id="seeAlsoSection" class="section" name="collapseableSection"><h4 class="subHeading">Other Resources</h4><b>Replication Programming Concepts</b><br /><b>Developer InfoCenter (Replication)</b><br /><b>Samples (Replication)</b><br /><br />
		<h4 class="subHeading">
			Help and Information
		</h4>
		<b>
			
			Getting SQL Server 2008 Assistance
		</b>
	</div><!--[if gte IE 5]>
			<tool:tip element="seeAlsoToolTip" avoidmouse="false"/><tool:tip element="languageFilterToolTip" avoidmouse="false"/><tool:tip element="roleInfoSpan" avoidmouse="false"/>
		<![endif]--></div>
      <div id="footer">
			
			© 2008 Microsoft Corporation. All rights reserved.
		</div>
    </div>
  </body>
</html>